<template>
  <div>
    <div class="list-warp" >
      <ul>
        <a href="电影详情.html" v-for="(item, index) in filmList2" :key="index">
          <li>
            <img :src="item.poster" alt="" />
            <div class="info">
              <p class="name">
                {{ item.name }}
                <span>{{ item.filmType.name }}</span>
              </p>
              <p class="actors">
                <span
                  class="label"
                  v-for="(item2, index2) in item.actors"
                  :key="index2"
                  >主演：{{ item2.name }}</span
                >
              </p>
              <p class="detail">
                <span class="label"
                  >上映日期：星期{{
                    (((Math.floor(item.premiereAt / 86400000) + data) % 7) +
                      2) %
                    7
                  }}
                  {{ month }}月{{
                    Math.ceil(item.premiereAt / 86400000) + data
                  }}日</span
                >
              </p>
            </div>
            <div class="play">预约</div>
          </li>
        </a>
      </ul>
    </div>
  </div>
</template>

<script>
import axios from "axios";
export default {
  name: "comingPlay",
  data() {
    return {
      filmList2: [],
      month:new Date().getMonth() + 1,
      data:new Date().getDate(),
      day:new Date().getDay()
    };
  },
  created() {
    this.getData();
  },

  methods: {
    getData() {
      axios({
        url: "https://m.maizuo.com/gateway",
        method: "get",
        params: {
          cityId: 320100,
          pageNum: 1,
          pageSize: 10,
          type: 2,
          k: 7750223,
        },
        headers: {
          "X-Client-Info":
            '{"a":"3000","ch":"1002","v":"5.0.4","e":"16179368764092240544661505","bc":"110100"}',
          "X-Host": "mall.film-ticket.film.list",
        },
        // dataType: "json",
      }).then((res) => {
        // console.log(res);
        const films = res.data.data.films;
        // console.log(films);
        this.filmList2 = films;
      });
    },
  },
};
</script>

<style>
</style>